module.exports = function(sequelize, DataTypes) {
  var Note = sequelize.define('Note', {
    id : {type : DataTypes.INTEGER, primaryKey:true, autoIncrement:true},
    user_id: {
      type: DataTypes.INTEGER,
      references: "users",
      referencesKey: 'id'
    },
    conversation_id: {
      type: DataTypes.INTEGER,
      references: "conversations",
      referencesKey: 'id'
    },
    location_id: { // note can have an optional location
      type: DataTypes.INTEGER,
      references: "locations",
      referencesKey: 'id'
    },
    text: DataTypes.STRING,
    added: DataTypes.DATE
  }, {
      associate: function(models) {
          Note.belongsTo(models.User, {as:'Author'});
          Note.belongsTo(models.Conversation);
      }
  })
 
  return Note
}